package iqq.util;

import java.awt.Image;

import javax.swing.ImageIcon;

/**
 * Image Tools
 * 
 * @author ChenZhiHui
 * @create-time 2013-3-8
 */
public class ImageUtils {

	public static Image getScaledInstance(Image img, int width, int height,
			int hints) {
		if (img != null) {
			img = img.getScaledInstance(width, height, hints);
		}
		return img;
	}

	public static Image getScaledInstance(Image img, int width, int height) {
		return getScaledInstance(img, width, height, 100);
	}

	public static ImageIcon getScaledInstance(ImageIcon ImgIcon, int width,
			int height, int hints) {
		if (ImgIcon != null) {
			ImgIcon.setImage(getScaledInstance(ImgIcon.getImage(), width,
					height, hints));
		}
		return ImgIcon;
	}

	public static ImageIcon getScaledInstance(ImageIcon ImgIcon, int width,
			int height) {
		if (ImgIcon != null) {
			return getScaledInstance(ImgIcon, width, height, 100);
		}
		return ImgIcon;
	}

}
